#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <thread>
#include<functional>
using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::thread;
using std::vector;

using func = std::function<void(int,int)>;
template<class F, class T>
T useF(F f, T x)//这里会实例化出很多函数，因为这里f是一直变化的
{
	static int count = 0;
	cout << "count:" << ++count << endl;
	cout << "count:" << &count << endl;
	return f(x);
}
double f(double i)
{
	return i / 2;
}
struct Functor
{
	double operator()(double d)
	{
		return d / 3;
	}
};
int main()
{
	// 函数名
	cout << useF(f, 11.11) << endl;
	// 函数对象
	cout << useF(Functor(), 11.11) << endl;
	// lambda表达式
	cout << useF([](double d)->double { return d / 4; }, 11.11) << endl;
	return 0;
}
